package com.exam.service.impl;

import com.exam.mapper.ExamManageMapper;
import com.exam.mapper.ScoreMapper;
import com.exam.mapper.ScoreVCMapper;
import com.exam.po.ExamManage;
import com.exam.po.Score;
import com.exam.po.ScoreExample;
import com.exam.po.Student;
import com.exam.service.ScoreService;
import com.exam.vo.ScoreVC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhanggaoxiang
 * @ClassName ScoreServiceImpl
 * @Description TODO
 * @Date 2021/1/12 15:48
 * @Version 1.0
 **/
@Service
public class ScoreServiceImpl implements ScoreService {
   @Autowired
   private ScoreMapper scoreMapper;
   @Autowired
   private ExamManageMapper examManageMapper;
   @Autowired
   private ScoreVCMapper scoreVCMapper;
    @Override
    public List<Student> findScoreBySId(Integer page, Integer size) {
        return scoreMapper.findScoreBySId(page,size);
    }

    @Override
    public List<Score> findScore(Integer studentId) {
        return scoreMapper.findScore(studentId);
    }

    @Override
    public List<ExamManage> findExams(Integer page, Integer size) {
        return examManageMapper.findExams(page,size);
    }

    @Override
    public List<Score> findByExamCode(Integer examCode) {
        return scoreMapper.findByExamCode(examCode);
    }

    @Override
    public Integer findStudentsCount() {
        return scoreMapper.countByExample(new ScoreExample());
    }

    @Override
    public Integer findCount() {
        return scoreMapper.countByExample(new ScoreExample());
    }
    /**
     * 管理员分页查询成绩
     * @param page
     * @param size
     * @return
     */
    @Override
    public List<ScoreVC> selectAdminBystudent(Integer current, Integer size) {

        return scoreVCMapper.selectAdminBystudent(current,size);
    }

    /**
     * 管理员审核
     * @param record
     * @return
     */
    @Override
    public int updateAdminBySelective(Integer scoreid) {

        return scoreMapper.updateAdminBySelective(scoreid);


    }

    @Override
    public int countExample() {
        return scoreMapper.countExample();
    }

    /**
     * 查询score表的记录
     * @return
     */
    @Override
    public int countScoreVC() {
        return scoreVCMapper.countScoreVC();
    }

    /**
     * 查询student表的记录
     * @return
     */
    @Override
    public int countStudent() {
        return scoreVCMapper.countStudent();
    }
}
